<%@ Reference Page="~/blog.aspx" %>
<%@ Reference Control="~/Controls/GroupBlogTabs.ascx" %>
<%@ Reference Control="~/Controls/UserBlogTabs.ascx" %>
<%@ Page language="vb" EnableViewStateMac="true" Inherits="_2bMatesSite.send_blog" ValidateRequest=false CodeFile="send_blog.aspx.vb" CodeFileBaseClass="_2bMatesSite.BaseWebPage" %>
<%@ Register tagprefix="UserBlogTabs" Tagname="UserBlogTabs" Src="Controls/UserBlogTabs.ascx" %>
<%@ Register tagprefix="GroupBlogTabs" Tagname="GroupBlogTabs" Src="Controls/GroupBlogTabs.ascx" %>
<FORM id="Form1" action="" method="post" runat="server">
	<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" height="100%">
		<tr>
			<td colspan="3">
				<table cellspacing="0" cellpadding="0" width="100%" border="0" class="page_title" id="Table1">
					<tr>
						<td><asp:literal id="litMainPageTitle" runat=server>Post New Blog</asp:literal></td>
						<td align="right"><asp:hyperlink id="hlRightLink" cssclass="white_link" runat="server"></asp:hyperlink></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td valign="top" height="100%" class="main_table_border">
				<div class="content">
					<table cellspacing="0" cellpadding="0" width="100%" border="0">
						<tr id="trSendBlog" runat=server>
							<td valign="top" align="center">
							<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0"  class="main_text">
								<UserBlogTabs:UserBlogTabs id="ucBlogTabs" runat="server"></UserBlogTabs:UserBlogTabs>	
								<GroupBlogTabs:GroupBlogTabs id="grpBlogTabs" runat="server"></GroupBlogTabs:GroupBlogTabs>																
								<TR>
									<TD align="left" valign=top>
									<TABLE cellSpacing="0" cellPadding="0" border="0" class="main_text_opposite_form">
										<tr>
											<td class="small" height="15" colspan="2">&nbsp;</td>
										</tr><!--
										<TR>
											<TD align="right" colSpan="2"><B><asp:hyperlink id="hlReturnToBlogList" cssclass="main_text_bold" runat=server>Return to Blog List</asp:hyperlink></B>&nbsp;</TD>
										</TR>-->
										<TR>
											<TD class="small" align="left" colSpan="2" id="error">&nbsp;
												<asp:ValidationSummary id="ValidationSummary1" runat="server" Height="38px" ForeColor="#F04C03" DisplayMode="List"
													CssClass="val_summary" Width="100%"></asp:ValidationSummary></TD>
										</TR>
										<TR>
											<TD><asp:Literal id="litSubject" runat=server>Subject</asp:Literal></TD>
											<TD vAlign="top">
												<asp:TextBox id="txtSubject_bulletin" runat="server" CssClass="mail_field" MaxLength="150" width="500px"></asp:TextBox>
												<asp:RequiredFieldValidator id="rvSubject_bulletin" runat="server" Display="None" ControlToValidate="txtSubject_bulletin"
													ErrorMessage="Please fill in field Subject"></asp:RequiredFieldValidator><asp:customvalidator id="cvHtmlInSubject" runat="server" controltovalidate="txtSubject_bulletin" errormessage="HTML is not allowed in Subject field"	display="None"></asp:customvalidator></TD>
										</TR>
										<TR>
											<TD width="60"><B><asp:Literal id="litBody" runat=server>Body</asp:Literal></B></TD>
											<TD vAlign="top">
												<asp:TextBox id="txtMessage_bulletin" runat="server" CssClass="scrollbar" Width="500px" Rows="8"
													TextMode="MultiLine" MaxLength="10000" height="200px"></asp:TextBox>
												<asp:RequiredFieldValidator id="rvMessage_bulletin" runat="server" Display="None" ControlToValidate="txtMessage_bulletin"
													ErrorMessage="Please fill in field Message"></asp:RequiredFieldValidator><asp:customvalidator id="cvHtmlInBody" runat="server" controltovalidate="txtMessage_bulletin" errormessage="HTML is not allowed in Body field"	display="None"></asp:customvalidator></TD>
										</TR>
										<tr>
											<td class="small" colspan="2" height="4">&nbsp;</td>
										</tr>
										<tr>
											<td>&nbsp;</td>
											<td class="small" height="10" align="left"><input type=button value="Add link" name=btnAddLink onclick="javascript: addLink('_ctl0:txtMessage_bulletin')" class="btn" style="WIDTH:70px"  onmouseover="ButtonMouseOver(this);" onmouseout="ButtonMouseOut(this);">&nbsp; 
											&nbsp;<input type=button value="Add image" name=btnAddImage  onclick="javascript: addImage('_ctl0:txtMessage_bulletin')" class="btn" style="WIDTH:80px"  onmouseover="ButtonMouseOver(this);" onmouseout="ButtonMouseOut(this);"></td>
										</tr>
										<TR>
											<TD class="small" colSpan="2" height="10">&nbsp;</TD>
										</TR>
										<TR>
											<td>&nbsp;</td>
											<TD class="small" align="left" height="21">
												<asp:button id="btn_send_bulletin" runat="server" CssClass="btn" Text="Post" Width="50px" onmouseover="ButtonMouseOver(this);" onmouseout="ButtonMouseOut(this);" onclick="btn_send_bulletin_Click"></asp:button></td>
										</TR>
									</TABLE>
									</TD>
								</TR>
							</TABLE>
							</td>
						</tr>
						<tr id="trConfrimation" runat=server visible=false>
							<td colspan="2">
								<table cellspacing="0" cellpadding="0" width="500" border="0" class="main_text">
									<tr>
										<td>
											<asp:label id="lblConfirmMessage" runat="server" font-bold="True">This is how your blog entry will appear on the page. Please confirm your blog:</asp:label>
											<br/><br/>
											<b><asp:literal id="litSubjectConfirm" runat=server>Subject</asp:literal></b>
											<br/><br/>
											<pre style="WORD-WRAP: break-word" wrap><asp:literal id="litBodyConfirm" runat=server>Body</asp:literal></pre><br />
										</td>
									</tr>
									<tr>
										<td valign="top">
											<asp:button id="btnPost" runat="server" cssclass="btn" text="Post Blog" width="113px" onmouseover="ButtonMouseOver(this);" onmouseout="ButtonMouseOut(this);" onclick="btnPost_Click"></asp:button><br><br>
											<asp:button id=btnEdit runat="server" cssclass="btn" text="Edit"  onmouseover="ButtonMouseOver(this);" onmouseout="ButtonMouseOut(this);" onclick="btnEdit_Click"></asp:button>
											<asp:button id="btnCancelConfirmation" runat="server" cssclass="btn" text="Cancel" causesvalidation="False"  onmouseover="ButtonMouseOver(this);" onmouseout="ButtonMouseOut(this);" onclick="btnCancel_Click"></asp:button>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>	
				</div>
			</td>
			<!-- BEGIN SKYSCRAPER ADVERTISEMENT -->	
			<!--
			<td class="small" width="10">&nbsp;</td>
			<td class="border_adv" vAlign="top" width="203" height="100%">
				<table cellSpacing="1" cellPadding="0" width="100%" border="0">
					<tr>
						<td class="small" width="10">&nbsp;</td>
						<td class="advertisement" width="193"><asp:Literal id="litSkyscraperAdvertisement" runat=server></asp:literal></td>
					</tr>
				</table>
			</td>-->
			<!-- END SKYSCRAPER ADVERTISEMENT -->
		</tr>
	</table>
</FORM>
<script>
	// Add blog link/image functionality

	//Function to add link
	var g_messageBox;
	
	function addLink(messageBox){
		var linkPath = new String()
		linkPath = popLinkWin("link", messageBox);
		
		addLinkNS (linkPath);
		//if (typeof(linkPath)!="undefined") {
		//	msgBox = eval("document.forms[0]['" + messageBox + "']")
		//	msgBox.value = msgBox.value + "<%=sLinkTag%>" + linkPath + " ";				
		//}
	}
	
	function addLinkNS(linkPath){		
		if (typeof(linkPath)!="undefined") {
			msgBox = eval("document.forms[0]['" + g_messageBox + "']")
			msgBox.value = msgBox.value + "<%=sLinkTag%>" + linkPath + " ";				
		}
	}

	//Function to add image
	function addImage(messageBox) {	
		var linkPath = new String()
		linkPath = popLinkWin("image", messageBox);
		
		addImageNS(linkPath);
		
		//if (typeof(linkPath)!="undefined") {
		//	msgBox = eval("document.forms[0]['" + messageBox + "']")
		//	msgBox.value = msgBox.value + "<%=sImageTag%>" + linkPath + " ";				
		//}
	}
	
	function addImageNS(linkPath) {	
		if (typeof(linkPath)!="undefined") {
			msgBox = eval("document.forms[0]['" + g_messageBox + "']")
			msgBox.value = msgBox.value + "<%=sImageTag%>" + linkPath + " ";				
		}
	}
		
	function showDialog(url, width, height, messageBox) {
		var sFeatures;
		sFeatures="dialogWidth: "+width+"px; ";
		sFeatures+="dialogHeight: "+height+"px; ";
		sFeatures+="help: no; ";
		sFeatures+="resizable: no; ";
		sFeatures+="scroll: no; ";
		sFeatures+="status: yes; ";
		sFeatures+="unadorned: no; ";

		var result, oWin;
		
		g_messageBox = messageBox;
		
		if (document.all) {
			result = window.showModalDialog(url,"", sFeatures);
		} else {
			oWin = window.open(url,"","width="+width+"px, height="+height+"px");
		}
			
		return result;
		
	}

	function popLinkWin(sType, messageBox) {
		return showDialog("add_link.aspx?type=" + sType, 400, 168, messageBox);
	}
</script>

